package org.example.Contant;
import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException{

    private final String code;
    private final String description;

    public BusinessException(String message, String code, String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    //从全局错误代码的枚举中获取参数
    public BusinessException(ErrorCode errorCode){
        //super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description=errorCode.getDescription();
    }


    public BusinessException(ErrorCode errorCode,String description){
        //super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description=description;
    }

    public BusinessException(String code,String description){
        //super(errorCode.getMessage());
        this.code = code;
        this.description=description;
    }

}
